(function($) { $.fn.extend({ cpsAdSlide: function(o) { var defaults = { speed: 5000, animate: 1000 }; o = $.extend(defaults, o); this.each(function() { var div = $(this); var ul = $(div).find("ul"); var li = ul.find("li"); var len = $(li).length; var index = 0; cpsShowSlide(); function cpsShowSlide() { cpsShowGifStop(); var speed = o.speed; if ($.type(o.speed) !== 'number') { speed = $(li).eq(index).attr('delay') } $(li).eq(index).find("img:first").attr("src", $(li).eq(index).find("img").attr("src").replace(/gifstop/, "")); $(li).hide().eq(index).show(); var s = setTimeout(cpsShowSlide, speed); index++; if (index == len) { index = 0 } } function cpsShowGifStop() { $(li).each(function() { if ($(this).find("img:first").attr("src").search(/gifstop/) == -1) { $(this).find("img:first").attr("src", "gifstop" + $(this).find("img").attr("src")); } }) } }) } }) })(jQuery); $(function() { var ASY_URL = 'http://asy.cps.com.cn'; var LOG_URL = 'http://asy.cps.com.cn'; var IMG_URL = 'http://images.cps.com.cn'; var posIdArr = new Array(); var cId = typeof(catId) == 'undefined' ? 0 : catId; $("div[id^='cps_adpos_']").each(function() { var posId = $(this).attr("id").replace('cps_adpos_', ''); posIdArr.push(posId) }); $.extend(window._cps_ad_config, { posId: posIdArr.join(',') }); $.ajax({ url: ASY_URL + '/ads/get/', type: 'post', data: window._cps_ad_config, dataType: 'jsonp', jsonpCallback: "adCallback", success: function(data) { var isFlash = false; var flashWidth = 0, flashHeight = 0; $.each(data, function(index, d) { var adContent = ''; if (typeof(d.item) != 'undefined' && d.item.length) { $.each(d.item, function(i, ad) { var width = ad.width - ad.style.border * 2; var height = ad.height - ad.style.border * 2; var style = 'style="float: left; width: ' + width + 'px; height: ' + height + 'px; border-width: ' + ad.style.border + 'px; border-style: solid; border-color:' + ad.style.border_color + '; padding-top: ' + ad.style.pt + 'px; padding-right: ' + ad.style.pr + 'px;padding-bottom: ' + ad.style.pb + 'px;padding-left: ' + ad.style.pl + 'px; margin-bottom: ' + ad.style.mb + 'px;margin-left: ' + ad.style.ml + 'px;position: relative; "'; if (ad.ad_modus == '1') { adContent += '
' } else if (ad.ad_modus == '2') { var arr = [261,262,263,264]; adContent += '